home *** CD-ROM | disk | FTP | other *** search
- UseCoordinates(PIXEL)
- UseFont("Arial",5,15,NOBOLD,NOITALIC,NOUNDERLINE,0,0,255)
-
- SetColorPalette(GENERATE)
-
- WinGetActive(Win$)
- Title$ = "Profiling Pixel Values"
- WinTitle(Win$,Title$)
- WinLocate("Profiling Pixel Values",200,100,760,470,Res)
- WinShow("Profiling Pixel Values",TOPMOST,Res)
- DirGet(SourceDir$)
-
- UseBrush(SOLID,128,128,128)
-
- InfoMenu(REMOVE)
- SetMenu("File",IGNORE,
- "E&xit",Leave,
- ENDPOPUP,
- "&Help",Help,
- ENDPOPUP,
- "&About",About,
- ENDPOPUP)
- DrawText(100,50,"Click anywhere to start")
- SetMouse(0,0,400,370,Profile,X,Y)
-
- Wait_for_Input:
- WaitInput()
-
- Leave:
- End
-
- About:
- AboutUser("About Profile","PiXCLpro 4.0 Sample program","")
- Goto Wait_for_Input
-
- Profile:
- UseBackground(TRANSPARENT,192,192,192)
- DrawBackGround
- SetMouse(0,0,400,370,Start,X,Y)
- SetRightMouse()
-
- Start:
- SetColorPalette(GENERATE)
- DrawBitMap(0,0,"geol.bmp"){400x324}
- UseCaption(Title$)
- UsePen(NULL,1,0,0,0)
- UseBrush(SOLID,255,255,255)
-
- DrawEdgeRectangle(400,0,420,324,RAISEDEDGE,ADJUST,LEFT)
-
- DrawEdgeRectangle(408,1,542,86,SUNKENEDGE,ADJUST,RECT)
- DrawEdgeRectangle(408,89,542,174,SUNKENEDGE,ADJUST,RECT)
- DrawEdgeRectangle(408,179,542,264,SUNKENEDGE,ADJUST,RECT)
-
- DrawRectangle(410,2,540,84)
- DrawRectangle(410,90,540,172)
- DrawRectangle(410,180,540,262)
-
- X = 0
- Xg = 411
- MaxR = 0 MinR = 255
- MaxG = 0 MinG = 255
- MaxB = 0 MinB = 255
- UseCursor(WAIT)
- Loop:
- GetPixel(X,Y,R,G,B,Res)
- If R > MaxR Then MaxR = R
- If G > MaxG Then MaxG = G
- If B > MaxB Then MaxB = B
-
- If R < MinR Then MinR = R
- If G < MinG Then MinG = G
- If B < MinB Then MinB = B
- X = X + 2
- Xg = Xg + 1
- R = R / 4 G = G / 4 B = B / 4
- UsePen(SOLID,1,0,0,255) Y1 = 83 - B
- DrawLine(Xg,83,Xg,Y1)
-
- UsePen(SOLID,1,0,128,0) Y2 = 171 - G
- DrawLine(Xg,171,Xg,Y2)
-
- UsePen(SOLID,1,255,0,0) Y3 = 261 - R
- DrawLine(Xg,261,Xg,Y3)
- If X < 252 Then Goto Loop
-
- DrawNumber(440,4,MinB) DrawNumber(480,4,MaxB)
- DrawNumber(440,92,MinG) DrawNumber(480,92,MaxG)
- DrawNumber(440,182,MinR) DrawNumber(480,182,MaxR)
-
- UsePen(SOLID,1,255,255,255)
- DrawLine(0,Y,400,Y)
-
- UseCursor(ARROW)
- SetRightMouse(410,2,540,84,BluProfile,Xx,Yy,
- 410,90,540,172,GrnProfile,Xx,Yy,
- 410,180,540,262,RedProfile,Xx,Yy)
-
- Goto Wait_for_Input
-
-
- Help:
- MessageBox(OK,1,INFORMATION,
- "To run this sample program, click anywhere in the window,
- and an image is displayed. The line at the X coordinate
- that you clicked is scanned for the display RGB pixel
- values, and three profiles are drawn to the right of the
- image, plus the minimum and maximum values for each color
- in the scanned line.
-
- This program is best viewed with a 2MB or better video card.",
- "Profiling Pixel values",Res)
-
- Goto Wait_for_Input
-
- RedProfile:
- MessageBox(OK,1,EXCLAMATION,
- "These are the pixel values read from the display
- memory, not from the image file itself.",
- "Profile of the Red pixels.",Res)
- Goto Wait_for_Input
-
- GrnProfile:
- MessageBox(OK,1,EXCLAMATION,
- "These are the pixel values read from the display
- memory, not from the image file itself.",
- "Profile of the Green pixels.",Res)
- Goto Wait_for_Input
-
- BluProfile:
- MessageBox(OK,1,EXCLAMATION,
- "These are the pixel values read from the display
- memory, not from the image file itself.",
- "Profile of the Blue pixels.",Res)
- Goto Wait_for_Input
-
-